package com.example.hotsearchplatform.controller;

import com.example.hotsearchplatform.dto.HotTopDifferentDTO;
import com.example.hotsearchplatform.dto.HotValueByPlatformDTO;
import com.example.hotsearchplatform.service.impl.AnalysisServiceImpl;
import com.example.hotsearchplatform.vo.searchCountVO;
import com.example.hotsearchplatform.vo.KeyWordListAndTopListVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import com.example.hotsearchplatform.result.Result;
import com.example.hotsearchplatform.service.AnalysisService;
import com.example.hotsearchplatform.vo.InfoLookVO;
import com.example.hotsearchplatform.vo.WordCloudVO;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;

import java.util.List;

@RestController
@RequestMapping("analysis")
@Tag(name="热搜数据分析")
public class AnalysisController {
    @Autowired
    private AnalysisService analysisService;

    @Operation(summary = "饼图展示信息")
    @GetMapping("/pieChart")
    public Result getPieChart() {
        return Result.ok(analysisService.getPieChart(),"success");
    }

    @Operation(summary = "不同日期热搜巅峰热度")
    @PostMapping("/getHotTopByDifferentDay")
    public Result getHotTopByDifferentDay(@RequestBody HotTopDifferentDTO hotTopDifferentDTO){
        List<KeyWordListAndTopListVO> list=analysisService.getHotTopByDifferentDayInfo(hotTopDifferentDTO);
        return Result.build(list);
    }


    @Operation(summary = "词云图展示信息")
    @GetMapping("/getAllWordCloud")
    public Result getAllWorldCloudFun(@RequestParam String platform){
        List<WordCloudVO> wordCloudVOList=analysisService.getAllWorldInfo(platform);
        return Result.build(wordCloudVOList);
    }

    @Operation(summary = "不同平台每日关键字热搜总次数 ")
    @GetMapping("/searchCount")
    public Result<List<searchCountVO>> getSearchCount() {
        List<searchCountVO> list = analysisService.getSearchCount();

        return Result.ok(list);
    }

}
